package com.tools;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;

/**
 * @Author: clm
 * @Date: 2018-10-29
 */

public class GLBufferTools {
    public final static FloatBuffer getFloatBuffer(float[] floats){
        FloatBuffer floatBuffer = ByteBuffer.allocateDirect(floats.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
        floatBuffer.put(floats).position(0);
        return floatBuffer;
    }
    public final static IntBuffer getIntBuffer(int[] ints){
        IntBuffer intBuffer = ByteBuffer.allocateDirect(ints.length * 4).order(ByteOrder.nativeOrder()).asIntBuffer();
        intBuffer.put(ints).position(0);
        return intBuffer;
    }
}
